﻿using PetaPoco;
using PmSoft;
using PmSoft.Caching;
using PmSoft.Entity;
using System.ComponentModel;

namespace Modules.System.Security
{
    /// <summary>
    /// 登陆安全相关
    ///</summary>
    [TableName("sys_security")]
    [Description("登录安全")]
    [PrimaryKey("security_id", AutoIncrement = true)]
    [CacheSetting(true)]
    [Serializable]
    public class SysSecurity : IEntity
    {
        /// <summary>
        /// 主键
        ///</summary>
        [Column("security_id")]
        public int SecurityId { get; set; }

        /// <summary>
        /// 密码
        ///</summary>
        [Column("password")]
        public string Password { get; set; }

        /// <summary>
        /// 微信openid
        ///</summary>
        [Column("open_id")]
        public string? OpenId { get; set; }

        /// <summary>
        /// 微信unionid
        ///</summary>
        [Column("union_id")]
        public string? Unionid { get; set; }

        /// <summary>
        /// 最后登陆IP
        ///</summary>
        [Column("last_login_ip")]
        public string LastLoginIp { get; set; }

        /// <summary>
        /// 最后登陆时间
        ///</summary>
        [Column("last_login_time")]
        public DateTime? LastLoginTime { get; set; }

        /// <summary>
        /// 用户类型
        ///</summary>
        [Column("user_type")]
        public UserType UserType { get; set; }

        /// <summary>
        /// 是否已认证
        ///</summary>
        [Column("is_auth")]
        public bool? IsAuth { get; set; }

        #region IEntity 成员

        [Ignore]
        object IEntity.EntityId { get { return SecurityId; } }

        #endregion IEntity 成员
    }
}